﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Gman.Entity.Entities;
using System.Collections.Generic;
using System.Web.Mvc;
using Gman.WebApp.ServiceControllers;


namespace Gman.WebApp.Models
{
    public class SistemaModel : BaseModel
    {
        private OperacionServiceController service = new OperacionServiceController();
        public ValidationBase Validator { get; set; }
        public List<KeyValuePair<string, string>> ValidationList = new List<KeyValuePair<string, string>>();
        public List<KeyValuePair<string, bool>> PropertyVisibilityList = new List<KeyValuePair<string, bool>>();

        public BienBE Bien { get; private set; }
        public Guid? ID { get; set; }
        public string Action { get; set; }
        public ToolBarModel ToolBar { get; set; }

        public SelectList TipoBien { get; private set; }

        public BienBE BienBusqueda { get; private set; }

        public List<BienBE> ListaActivos { get; private set; }

        public List<BienBE> Seleccionados { get; set; }

        public List<BienBE> toDelete { get; set; }

        public SistemaModel(BienBE bien)
        {
            Bien = bien;
            ID = Guid.NewGuid();

            TipoBien = ListaTipoBien();

            BienBusqueda = new BienBE();

            ListaActivos = new List<BienBE>();

            Seleccionados = new List<BienBE>();

            toDelete = new List<BienBE>();
            
        }

        public SelectList ListaTipoBien()
        {
            List<SelectListItem> list = new List<SelectListItem>();

            list.Add(seleccione);
            list.Add(new SelectListItem() { Text = "Activo", Value = "1" });
            list.Add(new SelectListItem() { Text = "Sistema", Value = "2" });

            return new SelectList(list, "Value", "Text");
        }

        public SistemaModel(IList<BienBE> lista, bool select)
        {
            Bien = new BienBE();
            ID = Guid.NewGuid();

            if (select)
            {
                Seleccionados = lista.ToList();
                ListaActivos = new List<BienBE>();
            }
            else
            {

                ListaActivos = lista.ToList();
                Seleccionados = new List<BienBE>();
            }

            TipoBien = ListaTipoBien();

            BienBusqueda = new BienBE();

            toDelete = new List<BienBE>();

        }
       

    }
}
